<!DOCTYPE html>
<html lang="">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <link rel="icon" href="<%= BASE_URL %>favicon.ico">
    <title><%= htmlWebpackPlugin.options.title %></title>
  </head>
  <body>
    <noscript>
      <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
    </noscript>
    <div id="app"></div>
    <!-- built files will be auto injected -->
  </body>
  <script type="text/javascript">
		document.addEventListener('plusready', function() {
			var first = null;
			var webview = plus.webview.currentWebview();
			plus.key.addEventListener('backbutton', function() {
				webview.canBack(function(e) {
					if (e.canBack) {
						webview.back(); //这里不建议修改自己跳转的路径  
					} else {
						//首次按键，提示‘再按一次退出应用’  
						if (!first) {
							first = new Date().getTime(); //获取第一次点击的时间戳  
							plus.nativeUI.toast("再按一次退出应用", {
								duration: 'short'
							}); //通过H5+ API 调用Android 上的toast 提示框  
							setTimeout(function() {
								first = null;
							}, 1000);
						} else {
							// 获取第二次点击的时间戳, 两次之差 小于 1000ms 说明1s点击了两次, 
							if (new Date().getTime() - first < 1000) {
								plus.runtime.quit(); //退出应用  
							}
						}
					}
				})
			});
		});
	</script>
</html>
